<?php require_once ("header.php"); ?>
<?php 
	if ($ad_check<1){
			header ("Location:../login.php?action=0");
		} 
		if ($ad_check==1) {
			echo "<br><br><br><br><br><b><br><center>You do not have privillage to set semester update.</center></b>";
			echo "<br><br><br><br><br><b><br><br>";
			echo "<META http-equiv=\"refresh\" content=\"2;URL=admin.php?action=102\">";
		}
?>

<?php
	//PROCESS FORM TO UPDATE DATE IN SEM UPDATE TABLE IN DATABASE
	if (isset($_POST['Submit'])) {
		$date="{$_POST['year']}-{$_POST['month']}-{$_POST['day']}";
		//TRUNCATE all data in current table
		$sql_truncate_data="TRUNCATE semester_update";
		$truncate_data=mysql_query($sql_truncate_data);
		//INSERT new date into table semester_update
		$sql_update_sem="INSERT INTO semester_update (next_update) VALUES ('$date')";
		$update_sem=mysql_query($sql_update_sem);
		?>
<style type="text/css">
<!--
.style1 {color: #000000;}
.style2 {color: #000000;}
-->
</style>

		<br><br><br>
		<table width="528" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#333333">
   		 <tr>
    		  <td><div align="center">
   		     <p>&nbsp;</p>
 		       <p class="style2">SETTING DATE FOR SEMESTER UPDATE SUCCESS </p>
 		       <p>&nbsp;</p>
			  </div></td>
 		   </tr>
		  </table><br><br><br>
 		 <?php
		echo "<META http-equiv=\"refresh\" content=\"2;URL=admin.php\">";
		
	}
	
	else {	
?>
<form method="POST" action="sem_update.php">
  
 
  <table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
      <p class="style1"><strong>SET NEXT SEMESTER UPDATE DATE</strong></p>
      <table width="339" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="226" class="style1">Date</td>
          <td width="10" class="style1">:</td>
          <td width="444" class="style1">
            <input name="year" type="text" size="4" maxlength="4">
          YYYY 
          <input name="month" type="text" size="2" maxlength="2">
          MM 
          <input name="day" type="text" size="2" maxlength="2">
          DD          </td>
        </tr>
      </table>
      <p>&nbsp;        </p>
      <p>
        <input type="submit" name="Submit" value="Submit">
      </p>
      <p>&nbsp; </p>
    </div></td>
  </tr>
</table>
</form>
<?php } ?>

<?php require_once ("footer.php"); ?>
